<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>后台主界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/admin.css' type="text/css" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/daily_record.css' type="text/css" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/treeview.css' type="text/css" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/news_list.css' type="text/css" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/news_add.css' type="text/css" />
<script src="<?php echo $static_url; ?>common/js/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="<?php echo $static_url; ?>common/js/common.js" type="text/javascript"></script>
<script src="<?php echo $static_url; ?>common/js/jquery.treeview.js" type="text/javascript"></script>
</head>
<body class="body_background">
	<div>
		<?php echo $header_nav; ?>
		<div class="common_container clearfix">
			<div class="crumbs">
				<span class="catalogue">文章管理</span>
				<a href="/www/admin/news/news_lists.php">文章列表</a> |
				<a href="/www/admin/news/news_add.php?category_id=<?php echo $category_id; ?>">添加文章</a> |
				<a href="/www/admin/news/empty_add.php?category_id=<?php echo $category_id; ?>">添加空白文章</a> |
				<a href="/www/admin/news/news_relative.php">手动推荐</a> |
				<a href="/www/admin/news/news_recover.php">回收站</a>
			</div>
			<div class="treeview_container" id="side_container">
				<div class="closeSidebar"><i title="点击隐藏左菜单" class="icon_close"></i></div>
				<h4>文章栏目</h4>
				<ul id="browser" class="filetree"></ul>
			</div>
			<div class="sidebar_container_hidden" style="margin-top:10px;margin-right:5px;"  >
				<div class="openSidebar"><i title="点击显示左菜单" class="icon_open"></i></div>
			</div>
			<div class="daily_record_main" id="main_container">
				<div class="news_main_container">
					<table class="record_tips"><tr><td class="colorstyle">回收站</td></tr></table>
					<table class="news_table">
						<tr>
							<th>排序</th>
							<th>ID</th>
							<th>标题</th>
							<th>删除人</th>
							<th>删除时间</th>
							<th>管理</th>
						</tr>
						<?php foreach($news_rs as $row): ?>
						<tr>
							<td><?php echo $row['orders']; ?></td>
							<td>
								<?php
								if( strlen($row['empty_id'])>3 ){
									echo '<span style="color:red;">'.$row['empty_id'].'</span>';
								}else{
									echo $row['title_id'];
								}
								?>
							</td>
							<td style="text-align:left;"><?php echo $row['title']; ?></td>
							<td><?php echo $row['del_username']; ?></td>
							<td><?php echo date('Y-m-d H:i:s',$row['updated']); ?></td>
							<td>
								<?php if($row['index_top']==1){echo '未置顶';}else{echo '已置顶';}; ?> | 
								<?php if($row['is_publish']==1 && $row['publish_time']>time()){echo '未发布';}else{echo '已发布';} ?> | 
								<a href="javascript:recover_news('<?php echo $row['title_id']; ?>');" onclick="return confirm('确定要恢复《<?php echo $row['title_id'].' '.$row['title']; ?>》这篇文章吗？')" >恢复</a> | 
								<a href="javascript:remove_news('<?php echo $row['title_id']; ?>');" onclick="return confirm('确定要彻底删除《<?php echo $row['title_id'].' '.$row['title'];  ?>》这篇文章吗？')" >彻底删除</a>
							</td>
						</tr>
						<?php endforeach; ?>
						<?php if( $page_html != '' ): ?>
						<tr>
							<td class="navPage" colspan="6"><?php echo $page_html; ?></td>
						</tr>
						<?php endif; ?>
					</table>
				</div>
			</div>
		</div>
	</div>
<script>
//加载栏目数据，并实例化
$(function(){
	var browser = $('#browser');
	browser.html('');
	$.ajax({
		type: "POST",
		url: "/admin/news/ajax/ajax_news_left_baner.php",
		dataType: 'html',
		data: {},
		beforeSend: function(){
			browser.html( '加载中...' );
		},
		success: function(data){
			browser.html( data ).treeview();
		}
	});
});
//彻底删除文章
function remove_news(i){<!-- i:id号 -->
	$.ajax({
		type: "POST",
		url: "/admin/news/ajax/ajax_remove.php",
		dataType:'json',
		data: {"id":i},
		success: function(msg){
			alert(msg.string);
			if(msg.error){
				window.location.href="/www/admin/news/news_recover.php";
			}
		}
	});
}
//恢复此条文章
function recover_news(i){<!-- i:id号 -->
	$.ajax({
		type: "POST",
		url: "/admin/news/ajax/ajax_recover.php",
		dataType:'json',
		data: {"id":i},
		success: function(msg){
			alert(msg.string);
			if(msg.error){
				window.location.href="/www/admin/news/news_recover.php";
			}
		}
	});
}
</script>
</body>
</html>